package juc.base;

import java.util.concurrent.TimeUnit;

public class Sleep7Interrupt {
    /*sleep适用于无锁同步场景*/
    public static void main(String[] args) throws Exception {
        Thread t1 = new Thread(() -> {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();
        System.out.println(t1.getState());
        TimeUnit.MILLISECONDS.sleep(500);
        System.out.println(t1.getState());
        t1.interrupt();

    }
}